'''
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Created by victor
# Created Time: '2020/1/10 9:34'
'''

import xadmin

from .models import UserAsk, UserMessage, CourseComments, UserCourse, UserFavorite

class UserAskAdmin(object):
    list_display = ['name','mobile','course_name','add_time']
    search_fields = ['name','mobile','course_name']
    list_filter = ['name','mobile','course_name','add_time']


class UserMessageAdmin(object):
    list_display = ['user','message','read_time','from_user','message_type','add_time']
    search_fields = ['user','message','read_time','from_user','message_type','add_time']
    list_filter = ['user','message','read_time','from_user','message_type','add_time']


class CourseCommentsAdmin(object):
    list_display = ['user','course','comments','status','add_time']
    search_fields = ['user','course','comments','status','add_time']
    list_filter = ['user','course','comments','status','add_time']

class UserCourseAdmin(object):
    list_display = ['user','course','is_finished','add_time']
    search_fields = ['user','course','is_finished','add_time']
    list_filter = ['user','course','is_finished','add_time']


class UserFavoriteAdmin(object):
    list_display = ['user', 'fav_id', 'fav_type', 'add_time']
    search_fields = ['user', 'fav_id', 'fav_type', 'add_time']
    list_filter = ['user', 'fav_id', 'fav_type', 'add_time']


# 将管理器与model进行注册关联
xadmin.site.register(UserAsk, UserAskAdmin)
xadmin.site.register(UserMessage, UserMessageAdmin)
xadmin.site.register(CourseComments, CourseCommentsAdmin)
xadmin.site.register(UserCourse, UserCourseAdmin)
xadmin.site.register(UserFavorite, UserFavoriteAdmin)